package com.lkcg.demo.util;


import com.lkcg.demo.common.mybatis.PagingResult;
import org.apache.commons.lang.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**

 */
public class ResultUtil {

    private ResultUtil() {
        throw new IllegalAccessError("Utility class");
    }

    public static void setResultMap(Map resultMap, PagingResult pagingResult){
        if(null != pagingResult){
            resultMap.put("list", pagingResult.getResultList());
            resultMap.put("totalPage", pagingResult.getTotalPage());
            resultMap.put("totalSize", pagingResult.getTotalSize());
            resultMap.put("currentPage", pagingResult.getCurrentPage());
        }
    }

    public static void setParams(Map params,int code,String message){
        if (params == null){
            params = new HashMap<>();
        }
        params.put("code", code);
        params.put("message", message);
    }
}
